Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RoomNav support #182

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

JasonJiazhiZhang
Copy link
Contributor

@JasonJiazhiZhang JasonJiazhiZhang commented Aug 5, 2019

Motivation and Context

This PR adds RoomNav support to habitat-api, alongside PointNav. This PR also serves as a reference point on how to adding new tasks in the future.

Huge thanks to Medhini Narasimhan @medhini for formalizing RoomNav task, creating dataset and making this PR possible! A tiny RoomNav dataset is so available here, courtesy of Medhini 🎉🎉

What Were Added?

To support a new task like room navigation, the following has been added:

  • Goals, sensors, episode and task, specific to RoomNav, are added in habitat/task/.
  • Env: RoomNavRLEnv added in habitat_baselines/common/environments.py.
  • Dataset: habitat/datasets/roomnav/roomnav_dataset.py and roomnav.zip.
  • Configs: habitat/configs/tasks/, habitat.configs/default.py, habitat_baselines/configs/roomnav/ and habitat_baselines/configs/default.py.

TODOs:

How Has This Been Tested

Pytest roomnav train/tests runs pass.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have completed my CLA (see CONTRIBUTING)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@facebook-github-bot facebook-github-bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Aug 5, 2019
@JasonJiazhiZhang JasonJiazhiZhang changed the title [WIP] Add RoomNav support Add RoomNav support Aug 8, 2019
@JasonJiazhiZhang JasonJiazhiZhang marked this pull request as ready for review August 8, 2019 19:16
@facebook-github-bot
Copy link
Contributor

Thank you for your pull request. We require contributors to sign our Contributor License Agreement, and yours has expired.

Before we can review or merge your code, we need you to email [email protected] with your details so we can update your status.

Copy link
Contributor

@mathfac mathfac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JasonJiazhiZhang and @medhini that's amazing seeing new task is coming with PPO baselines. Left some comments. I think it's in pretty mature stage, but need some polishing.

def __init__(self, sim: Simulator, config: Config):
self._sim = sim
self.room_name_to_id = {
"bathroom": 0,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad

@@ -377,6 +445,81 @@ def update_metric(self, episode, action):
)


@registry.register_measure
class RoomNavMetric(Measure):
r"""RoomNavMetric - SPL but for RoomNav
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name it more specific: RoomNavSPL maybe.

def get_reward(self, observations):
reward = self._rl_config.SLACK_REWARD

current_target_distance = self._distance_target()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current_target_distance isn't used.

self._rl_config = config.RL
self._core_env_config = config.TASK_CONFIG

self._previous_target_distance = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

current_target_distance isn't used.


self._previous_target_distance = None
self._previous_action = None
self._episode_distance_covered = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same _episode_distance_covered



def run_exp(exp_config: str, run_type: str, opts=None) -> None:
r"""Runs experiment given mode and config
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Usually main method is the last one in the file:

Suggested change
r"""Runs experiment given mode and config
r"""Runs an experiment with given mode and config.


room_id: str = attr.ib(default=None, validator=not_none_validator)
room_name: Optional[str] = None
room_aabb: Tuple[float] = attr.ib(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move all RoomNav Task related definitions to habitat/tasks/nav/room_nav_task.py and include it here. This Nav task file already grew too much and is hard to read.

room_aabb: Tuple[float] = attr.ib(
default=None, validator=not_none_validator
)
# room_id: str = attr.ib(default=None, validator=not_none_validator)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented out code.

@pytest.mark.skipif(
not baseline_installed, reason="baseline sub-module not installed"
)
@pytest.mark.parametrize(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is amazing way to cover all trainers smoke test with one parameterized test. Thank you for implementing it.



@registry.register_dataset(name="RoomNav-v1")
class RoomNavDatasetV1(Dataset):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can reduce code duplication if inherit from PointGoalDatasetV1 or create common parent class.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Do not delete this pull request or issue due to inactivity.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants